﻿<!-- saved from url=(0016)http://localhost -->
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" /> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />    
    <title>Markdown Linting</title>      
</head>
<body>
<b>Place holder</b>
<script src="scripts/markdown-it.min.js"></script>     
<script src="scripts/markdownlint-browser.min.js"></script> 
<script>window.markdownLintSettings = {}</script>
<script src="scripts/markdownlint-settings.js"></script>
<script>
    function markdownlinting(markdown) {
        var options = Object.assign({
                "strings": {
                    "content": markdown
                }
            },
            window.markdownLintSettings);

        console.log(JSON.stringify(options));        
        var results = window.markdownlint.sync(options);
        console.log(results);
        return JSON.stringify(results);
    }

    // IE needs to add this explicitly
    if (typeof Object.assign != 'function') {
        // Must be writable: true, enumerable: false, configurable: true
        Object.defineProperty(Object, "assign", {
            value: function assign(target, varArgs) { // .length of function is 2
                'use strict';
                if (target == null) { // TypeError if undefined or null
                    throw new TypeError('Cannot convert undefined or null to object');
                }

                var to = Object(target);

                for (var index = 1; index < arguments.length; index++) {
                    var nextSource = arguments[index];

                    if (nextSource != null) { // Skip over if undefined or null
                        for (var nextKey in nextSource) {
                            // Avoid bugs when hasOwnProperty is shadowed
                            if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
                                to[nextKey] = nextSource[nextKey];
                            }
                        }
                    }
                }
                return to;
            },
            writable: true,
            configurable: true
        });
    }

    var markdown = "THis is *markdown* text that is *italic*";
//    var markdown = `
//this is a  **markdown** string

//This is some markdown text  
//that extends to multiple lines.

//* These are items   
//This is a line continuation

//* These are itmes 2   
//This is another line continuation

//Here's what I want from this
//`;
        
    var results = markdownlinting(markdown);
    console.log(results);


</script>


</body>
</html>